package com.example.admin.controller;

import com.example.admin.service.UserService;
import com.usian.model.admin.dtos.AdUserDto;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AddUser;
import com.usian.model.user.dtos.LoginDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api
@Slf4j
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("user/v1/add_user")
    @ApiOperation(nickname = "注册用户信息",value="注册用户信息")
    public ResponseResult addUser(@RequestBody AddUser addUser){
        return userService.addUser(addUser);
    }

    @ApiOperation(nickname = "登录",value="登录")
    @PostMapping("user/v1/login_user")
    public ResponseResult loginUser(@RequestBody AdUserDto adUserDto){
        return userService.loginUser(adUserDto);
    }
}
